//
//  Brands_BrandsMainBrandSpecia_Tbv_WX.m
//  ZITHER
//
//  Created by weixin on 2019/4/11.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "Brands_BrandsMainBrandSpecia_Tbv_WX.h"
#import "Brands_BrandsMainBrandSpecia_Cell_WX.h"

@implementation Brands_BrandsMainBrandSpecia_Tbv_WX


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = RandomColor;

//        self.backgroundColor = HexColor(0xf5f5f5);
        [self def];
        
//        [self loadDate];
    }
    return self;
}

-(void)def{
    self.dataSource = self;
    self.delegate = self;
}

#pragma mark - UITableViewDelegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    //    NSLog(@"indexPath == %@",indexPath);
    //    NSLog(@"");
    //    if (self.block) {
    //        self.block(self.arrM[indexPath.section][indexPath.row]);
    //        [self.navigationController popViewControllerAnimated:YES];
    //    }
}

#pragma mark - UITableViewDataSource


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.model.modelArrM.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return  [self getBrands_BrandsMainBrandSpecia_Cell_WX:indexPath];
}

-(Brands_BrandsMainBrandSpecia_Cell_WX*)getBrands_BrandsMainBrandSpecia_Cell_WX:(NSIndexPath *)indexPath{
    
    static NSString *sectionCell = @"Brands_BrandsMainBrandSpecia_Cell_WX";
    Brands_BrandsMainBrandSpecia_Cell_WX *cell = [self dequeueReusableCellWithIdentifier:sectionCell];
    if (cell == nil) {
        cell = [[Brands_BrandsMainBrandSpecia_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.model = self.model.modelArrM[indexPath.row];
    return cell;
}

//-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
//
//    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 30)];
//    view.backgroundColor = HexColor(0xf5f5f5);
//    BaseLab *lab = [BaseLab initCustomLab:self.arrMBigWord[section] color:HexColor(0x333333) font:[UIFont fontWithName:@"PingFangSC-Medium" size:17]];
//    lab.frame = CGRectMake(15, 0, 20, 30);
//    lab.backgroundColor = HexColor(0xf5f5f5);
//    [view addSubview:lab];
//    return view;
//}

//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//    return 30;
//}


//设置区头不悬浮
//- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
//
//    CGFloat sectionHeaderHeight = 50;
//
//    if(scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {
//
//        scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0,0);
//
//    } else if (scrollView.contentOffset.y>=sectionHeaderHeight) {
//
//        scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
//
//    }
//
//}

-(void)setModel:(GoodsBrandTagstListSubModel *)model{
    _model = model;
    [self reloadData];
}
@end
